import Vue from 'vue'
import VueRouter from 'vue-router'
// 登录
import Login from '../views/Login.vue'
// 父级
import index from '../components/index'
// 首页
import HomeView from '../views/modules/HomeView'
// 反馈意见
import Feedback from '../views/modules/Feedback'
// 反馈公开
import PublicityOfFeedback from '../views/modules/PublicityOfFeedback'
// 整改会议 => 研究整改工作
import RectificationMeeting from '../views/modules/RectificationMeeting'
// 整改方案
import RectificationPlan from '../views/modules/RectificationPlan'
// 整改报告
import RectificationReport from '../views/modules/RectificationReport'
// 整改台账
import RectificationLedger from '../views/modules/RectificationLedger'
// 整改公开
import PublicRectification from '../views/modules/PublicRectification'
// 数据同步
import DataSynchronization from '../views/modules/DataSynchronization'
// 导入导出记录
import ImportAndExportRecords from '../views/modules/ImportAndExportRecords'
// 应用分区
import application from '../views/modules/application'
// 调阅资料
import fileList from '../views/modules/fileList'
import MainLayout from '@/views/layout/MainLayout.vue';

Vue.use(VueRouter)

// 获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
// 修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: '/',
    name: '登录',
    title: '登录',
    component: Login
  }, {
    path: '/index',
    name: 'index',
    title: 'index',
    component: MainLayout,
    children: [
      {
        path: '/home',
        name: '首页',
        title: '首页',
        component: HomeView
      }, {
        path: '/Feedback',
        name: '反馈意见',
        title: '反馈意见',
        component: Feedback
      }, {
        path: '/RectificationMeeting',
        name: '研究整改',
        title: '研究整改',
        component: RectificationMeeting
      },
      // {
      //   path: '/PublicityOfFeedback',
      //   name: '反馈公开',
      //   title: '反馈公开',
      //   component: PublicityOfFeedback
      // },
      {
        path: '/RectificationPlan',
        name: '整改方案',
        title: '整改方案',
        component: RectificationPlan
      },
      {
        path: '/RectificationLedger',
        name: '整改台账',
        title: '整改台账',
        component: RectificationLedger
      },
      {
        path: '/RectificationReport',
        name: '整改报告',
        title: '整改报告',
        component: RectificationReport
      }, {
        path: '/PublicRectification',
        name: '整改公开',
        title: '整改公开',
        component: PublicRectification
      },
      // {
      //   path: '/DataSynchronization',
      //   name: '数据同步',
      //   title: '数据同步',
      //   component: DataSynchronization
      // },
      {
        path: '/ImportAndExportRecords',
        name: '导入导出记录',
        title: '导入导出记录',
        component: ImportAndExportRecords
      }, {
        path: '/fileList',
        name: '调阅资料',
        title: '调阅资料',
        component: fileList,
        leftShow: true,
        hide: true,
        meta: {
          leftShow: true
        }
      }
    ]
  }, {
    path: '/application',
    name: '应用分区',
    title: '应用分区',
    component: application,
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
